package com.server.db.bean;

import com.sandking.tools.SK_Map;
import java.util.ArrayList;
import com.sandking.config.SK_BasePojo;
import com.sandking.config.SK_Config;
import com.alibaba.fastjson.JSON;
import java.util.Map;
import com.sandking.io.SK_ByteBuff;
import com.sandking.tools.SK_Plus;
import java.util.List;
import com.server.db.imp.YxImp;
import com.server.db.imp.WjImp;
import java.util.HashMap;

/**
 * 英雄
 */
public class Yx extends SK_BasePojo {

	public static final String TABLE_NAME = "英雄";
	public static final String CLASS_NAME = "Yx"; 
	
	/** id */
	private int id;
	
	/** 玩家id */
	private String wjid;
	
	/** 配置id */
	private int pzid;
	
	/** 等级 */
	private int dj;
	
	/** 经验 */
	private long jy;
	
	/** 主人id */
	private int zrid;
	
	/** 状态:1.酒馆 2.上阵 */
	private int zt;
	
	/** 创建时间 */
	private java.util.Date cjsj;
	
	
	public Yx() {
		super();
		set_status(SK_Config.SOURCE_OBJECT);
	}
	
	public Yx(int id, String wjid, int pzid, int dj, long jy, int zrid, int zt, java.util.Date cjsj) {
		super();
		this.id = id;
		this.wjid = wjid;
		this.pzid = pzid;
		this.dj = dj;
		this.jy = jy;
		this.zrid = zrid;
		this.zt = zt;
		this.cjsj = cjsj;
		set_status(SK_Config.SOURCE_OBJECT);
	}
	
	public int getId() {
		return id;
	}
	
	public void setId(int id) {
		changeSetId(id);
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(1);
			getByteBuff().writeInt(id);
		}
	}
	
	private void changeSetId(int id) {
		this.id = id;
		if(get_status() != SK_Config.SOURCE_OBJECT){
			addUpdateColumn("id",id);
		}
	}
	
	public void changeIdWith(int id){
		this.id += id;
		changeSetId(this.id);
		//不是源对象才记录变更操作
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(2);
			getByteBuff().writeInt(id);
		}
	}
	public void changeIdWithMin(int id,int min){
		this.id += id;
		this.id = this.id < min ? min : this.id;
		changeSetId(this.id);
		//不是源对象才记录变更操作
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(3);
			getByteBuff().writeInt(id);
			getByteBuff().writeInt(min);
		}	
	}
	public void changeIdWithMax(int id,int max){
		this.id += id;
		this.id = this.id > max ? max : this.id;
		changeSetId(this.id);
		//不是源对象才记录变更操作
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(4);
			getByteBuff().writeInt(id);
			getByteBuff().writeInt(max);
		}
	}
	public void changeIdWithMaxMin(int id,int max,int min){
		this.id += id;
		this.id = this.id < min ? min : this.id;
		this.id = this.id > max ? max : this.id;
		changeSetId(this.id);
		//不是源对象才记录变更操作
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(5);
			getByteBuff().writeInt(id);
			getByteBuff().writeInt(max);
			getByteBuff().writeInt(min);
		}	
	}	
	public String getWjid() {
		return wjid;
	}
	
	public void setWjid(String wjid) {
		changeSetWjid(wjid);
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(6);
			getByteBuff().writeString(wjid);
		}
	}
	
	private void changeSetWjid(String wjid) {
		this.wjid = wjid;
		if(get_status() != SK_Config.SOURCE_OBJECT){
			addUpdateColumn("玩家id",wjid);
		}
	}
	
	public int getPzid() {
		return pzid;
	}
	
	public void setPzid(int pzid) {
		changeSetPzid(pzid);
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(7);
			getByteBuff().writeInt(pzid);
		}
	}
	
	private void changeSetPzid(int pzid) {
		this.pzid = pzid;
		if(get_status() != SK_Config.SOURCE_OBJECT){
			addUpdateColumn("配置id",pzid);
		}
	}
	
	public void changePzidWith(int pzid){
		this.pzid += pzid;
		changeSetPzid(this.pzid);
		//不是源对象才记录变更操作
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(8);
			getByteBuff().writeInt(pzid);
		}
	}
	public void changePzidWithMin(int pzid,int min){
		this.pzid += pzid;
		this.pzid = this.pzid < min ? min : this.pzid;
		changeSetPzid(this.pzid);
		//不是源对象才记录变更操作
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(9);
			getByteBuff().writeInt(pzid);
			getByteBuff().writeInt(min);
		}	
	}
	public void changePzidWithMax(int pzid,int max){
		this.pzid += pzid;
		this.pzid = this.pzid > max ? max : this.pzid;
		changeSetPzid(this.pzid);
		//不是源对象才记录变更操作
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(10);
			getByteBuff().writeInt(pzid);
			getByteBuff().writeInt(max);
		}
	}
	public void changePzidWithMaxMin(int pzid,int max,int min){
		this.pzid += pzid;
		this.pzid = this.pzid < min ? min : this.pzid;
		this.pzid = this.pzid > max ? max : this.pzid;
		changeSetPzid(this.pzid);
		//不是源对象才记录变更操作
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(11);
			getByteBuff().writeInt(pzid);
			getByteBuff().writeInt(max);
			getByteBuff().writeInt(min);
		}	
	}	
	public int getDj() {
		return dj;
	}
	
	public void setDj(int dj) {
		changeSetDj(dj);
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(12);
			getByteBuff().writeInt(dj);
		}
	}
	
	private void changeSetDj(int dj) {
		this.dj = dj;
		if(get_status() != SK_Config.SOURCE_OBJECT){
			addUpdateColumn("等级",dj);
		}
	}
	
	public void changeDjWith(int dj){
		this.dj += dj;
		changeSetDj(this.dj);
		//不是源对象才记录变更操作
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(13);
			getByteBuff().writeInt(dj);
		}
	}
	public void changeDjWithMin(int dj,int min){
		this.dj += dj;
		this.dj = this.dj < min ? min : this.dj;
		changeSetDj(this.dj);
		//不是源对象才记录变更操作
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(14);
			getByteBuff().writeInt(dj);
			getByteBuff().writeInt(min);
		}	
	}
	public void changeDjWithMax(int dj,int max){
		this.dj += dj;
		this.dj = this.dj > max ? max : this.dj;
		changeSetDj(this.dj);
		//不是源对象才记录变更操作
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(15);
			getByteBuff().writeInt(dj);
			getByteBuff().writeInt(max);
		}
	}
	public void changeDjWithMaxMin(int dj,int max,int min){
		this.dj += dj;
		this.dj = this.dj < min ? min : this.dj;
		this.dj = this.dj > max ? max : this.dj;
		changeSetDj(this.dj);
		//不是源对象才记录变更操作
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(16);
			getByteBuff().writeInt(dj);
			getByteBuff().writeInt(max);
			getByteBuff().writeInt(min);
		}	
	}	
	public long getJy() {
		return jy;
	}
	
	public void setJy(long jy) {
		changeSetJy(jy);
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(17);
			getByteBuff().writeLong(jy);
		}
	}
	
	private void changeSetJy(long jy) {
		this.jy = jy;
		if(get_status() != SK_Config.SOURCE_OBJECT){
			addUpdateColumn("经验",jy);
		}
	}
	
	public void changeJyWith(long jy){
		this.jy += jy;
		changeSetJy(this.jy);
		//不是源对象才记录变更操作
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(18);
			getByteBuff().writeLong(jy);
		}
	}
	public void changeJyWithMin(long jy,long min){
		this.jy += jy;
		this.jy = this.jy < min ? min : this.jy;
		changeSetJy(this.jy);
		//不是源对象才记录变更操作
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(19);
			getByteBuff().writeLong(jy);
			getByteBuff().writeLong(min);
		}	
	}
	public void changeJyWithMax(long jy,long max){
		this.jy += jy;
		this.jy = this.jy > max ? max : this.jy;
		changeSetJy(this.jy);
		//不是源对象才记录变更操作
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(20);
			getByteBuff().writeLong(jy);
			getByteBuff().writeLong(max);
		}
	}
	public void changeJyWithMaxMin(long jy,long max,long min){
		this.jy += jy;
		this.jy = this.jy < min ? min : this.jy;
		this.jy = this.jy > max ? max : this.jy;
		changeSetJy(this.jy);
		//不是源对象才记录变更操作
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(21);
			getByteBuff().writeLong(jy);
			getByteBuff().writeLong(max);
			getByteBuff().writeLong(min);
		}	
	}	
	public int getZrid() {
		return zrid;
	}
	
	public void setZrid(int zrid) {
		changeSetZrid(zrid);
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(22);
			getByteBuff().writeInt(zrid);
		}
	}
	
	private void changeSetZrid(int zrid) {
		this.zrid = zrid;
		if(get_status() != SK_Config.SOURCE_OBJECT){
			addUpdateColumn("主人id",zrid);
		}
	}
	
	public void changeZridWith(int zrid){
		this.zrid += zrid;
		changeSetZrid(this.zrid);
		//不是源对象才记录变更操作
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(23);
			getByteBuff().writeInt(zrid);
		}
	}
	public void changeZridWithMin(int zrid,int min){
		this.zrid += zrid;
		this.zrid = this.zrid < min ? min : this.zrid;
		changeSetZrid(this.zrid);
		//不是源对象才记录变更操作
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(24);
			getByteBuff().writeInt(zrid);
			getByteBuff().writeInt(min);
		}	
	}
	public void changeZridWithMax(int zrid,int max){
		this.zrid += zrid;
		this.zrid = this.zrid > max ? max : this.zrid;
		changeSetZrid(this.zrid);
		//不是源对象才记录变更操作
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(25);
			getByteBuff().writeInt(zrid);
			getByteBuff().writeInt(max);
		}
	}
	public void changeZridWithMaxMin(int zrid,int max,int min){
		this.zrid += zrid;
		this.zrid = this.zrid < min ? min : this.zrid;
		this.zrid = this.zrid > max ? max : this.zrid;
		changeSetZrid(this.zrid);
		//不是源对象才记录变更操作
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(26);
			getByteBuff().writeInt(zrid);
			getByteBuff().writeInt(max);
			getByteBuff().writeInt(min);
		}	
	}	
	public int getZt() {
		return zt;
	}
	
	public void setZt(int zt) {
		changeSetZt(zt);
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(27);
			getByteBuff().writeInt(zt);
		}
	}
	
	private void changeSetZt(int zt) {
		this.zt = zt;
		if(get_status() != SK_Config.SOURCE_OBJECT){
			addUpdateColumn("状态",zt);
		}
	}
	
	public void changeZtWith(int zt){
		this.zt += zt;
		changeSetZt(this.zt);
		//不是源对象才记录变更操作
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(28);
			getByteBuff().writeInt(zt);
		}
	}
	public void changeZtWithMin(int zt,int min){
		this.zt += zt;
		this.zt = this.zt < min ? min : this.zt;
		changeSetZt(this.zt);
		//不是源对象才记录变更操作
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(29);
			getByteBuff().writeInt(zt);
			getByteBuff().writeInt(min);
		}	
	}
	public void changeZtWithMax(int zt,int max){
		this.zt += zt;
		this.zt = this.zt > max ? max : this.zt;
		changeSetZt(this.zt);
		//不是源对象才记录变更操作
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(30);
			getByteBuff().writeInt(zt);
			getByteBuff().writeInt(max);
		}
	}
	public void changeZtWithMaxMin(int zt,int max,int min){
		this.zt += zt;
		this.zt = this.zt < min ? min : this.zt;
		this.zt = this.zt > max ? max : this.zt;
		changeSetZt(this.zt);
		//不是源对象才记录变更操作
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(31);
			getByteBuff().writeInt(zt);
			getByteBuff().writeInt(max);
			getByteBuff().writeInt(min);
		}	
	}	
	public java.util.Date getCjsj() {
		return cjsj;
	}
	
	public void setCjsj(java.util.Date cjsj) {
		changeSetCjsj(cjsj);
		if(get_status() != SK_Config.SOURCE_OBJECT){
			getByteBuff().writeInt(32);
			getByteBuff().writeDate(cjsj);
		}
	}
	
	private void changeSetCjsj(java.util.Date cjsj) {
		this.cjsj = cjsj;
		if(get_status() != SK_Config.SOURCE_OBJECT){
			addUpdateColumn("创建时间",cjsj);
		}
	}
	
	
	//id
	public List<Yx> getYxsFkZrid(){
		return YxImp.getByZrid(id);
	}
	
	//玩家id
	public Wj getWjPkWjid(){
		return WjImp.getById(wjid);
	}
	//主人id
	public Yx getYxPkZrid(){
		return YxImp.getById(zrid);
	}
	public void addUpdateColumn(String key, Object val) {
		Map<String, Object> map = getUpdateColumns();
		if (map == null)
			return;
		map.put(key, val);
	}
	/**
	public void clearUpdateColumn() {
		Map<String, Object> map = getUpdateColumns();
		if (map == null)
			return;
		map.clear();
	}
	*/
	public Yx clone(){
		Yx yx = new Yx();
		yx.setId(this.getId());
		yx.setWjid(this.getWjid());
		yx.setPzid(this.getPzid());
		yx.setDj(this.getDj());
		yx.setJy(this.getJy());
		yx.setZrid(this.getZrid());
		yx.setZt(this.getZt());
		yx.setCjsj(this.getCjsj());
		yx.set_v(get_v());
		yx.set_status(SK_Config.CLONE_OBJECT);
		return yx.updatePrimaryIndex(); 
	}
	
	public Map<String, Object> toMap(){
        Map<String, Object> result = new HashMap<String, Object>();
        result.put("id", this.id);
        result.put("wjid", this.wjid);
        result.put("pzid", this.pzid);
        result.put("dj", this.dj);
        result.put("jy", this.jy);
        result.put("zrid", this.zrid);
        result.put("zt", this.zt);
        result.put("cjsj", this.cjsj);
        return result;
    }
    
    public String toString(){
        return toMap().toString();
    }
    
    public String toJson(){
    	return JSON.toJSONString(toMap());
    }
    
    /**
     * 数据库源字段Map
     */
    public Map<String, Object> toColumnNameMap(){
        Map<String, Object> result = new HashMap<String, Object>();
        result.put("id", this.id);
        result.put("玩家id", this.wjid);
        result.put("配置id", this.pzid);
        result.put("等级", this.dj);
        result.put("经验", this.jy);
        result.put("主人id", this.zrid);
        result.put("状态", this.zt);
        result.put("创建时间", this.cjsj);
        return result;
    }
    
    public String toColumnNameString(){
        return toColumnNameMap().toString();
    }
    
    public byte[] toBytes() throws Exception {
    	SK_ByteBuff byteBuff = SK_ByteBuff.allocate();
	    byteBuff.writeInt(this.id);
	    byteBuff.writeString(this.wjid);
	    byteBuff.writeInt(this.pzid);
	    byteBuff.writeInt(this.dj);
	    byteBuff.writeLong(this.jy);
	    byteBuff.writeInt(this.zrid);
	    byteBuff.writeInt(this.zt);
	    byteBuff.writeDate(this.cjsj);
	    return byteBuff.toByte();
    }
    
    public byte[] toSKBytes(){
    	SK_ByteBuff byteBuff = SK_ByteBuff.allocate();
    	byteBuff.writeMap(toMap());
	    return byteBuff.toByte();
    }
    
     public static Yx createForBytes(byte[] _byte) throws Exception {
     	SK_ByteBuff byteBuff = SK_ByteBuff.wrap(_byte);
     	Yx yx = new Yx();
	    yx.id = byteBuff.readInt(null);
	    yx.wjid = byteBuff.readString(null);
	    yx.pzid = byteBuff.readInt(null);
	    yx.dj = byteBuff.readInt(null);
	    yx.jy = byteBuff.readLong(null);
	    yx.zrid = byteBuff.readInt(null);
	    yx.zt = byteBuff.readInt(null);
	    yx.cjsj = byteBuff.readDate(null);
	    return yx.updatePrimaryIndex();
     }
     
     public static Yx createForSKBytes(byte[] _byte){
     		SK_ByteBuff byteBuff = SK_ByteBuff.wrap(_byte);
     		@SuppressWarnings("unchecked")
     		Map<String,Object> map = byteBuff.readMap(null);
	     	Yx yx = Yx.createForMap(map);
		    return yx.updatePrimaryIndex();
     }
    
    /**
     * 根据list创建对象
     */
    public static List<Yx> createForColumnNameList(List<Map<String, Object>> list){
    	List<Yx> yxs = new ArrayList<Yx>();
		for (Map<String, Object> map : list) {
			yxs.add(createForColumnNameMap(map));
		}
		return yxs;
    }
    
    /**
     * 根据map创建对象
     */
    public static Yx createForColumnNameMap(Map<String, Object> map){
    	Yx obj = new Yx();
	    obj.id = SK_Map.getInt("id", map);
	    obj.wjid = SK_Map.getString("玩家id", map);
	    obj.pzid = SK_Map.getInt("配置id", map);
	    obj.dj = SK_Map.getInt("等级", map);
	    obj.jy = SK_Map.getLong("经验", map);
	    obj.zrid = SK_Map.getInt("主人id", map);
	    obj.zt = SK_Map.getInt("状态", map);
	    obj.cjsj = SK_Map.getDate("创建时间", map);
        return obj.updatePrimaryIndex();
    }
    
    /**
     * 根据list创建对象
     */
    public static List<Yx> createForList(List<Map<String, Object>> list){
    	List<Yx> yxs = new ArrayList<Yx>();
		for (Map<String, Object> map : list) {
			yxs.add(createForColumnNameMap(map));
		}
		return yxs;
    }
    
    /**
     * 根据map创建对象
     */
    public static Yx createForMap(Map<String, Object> map){
    	Yx obj = new Yx();
	    obj.id = SK_Map.getInt("id", map);
	    obj.wjid = SK_Map.getString("wjid", map);
	    obj.pzid = SK_Map.getInt("pzid", map);
	    obj.dj = SK_Map.getInt("dj", map);
	    obj.jy = SK_Map.getLong("jy", map);
	    obj.zrid = SK_Map.getInt("zrid", map);
	    obj.zt = SK_Map.getInt("zt", map);
	    obj.cjsj = SK_Map.getDate("cjsj", map);
        return obj.updatePrimaryIndex();
    }
    
    public static Yx createForJson(String json){
    	Map<String, Object> map = JSON.parseObject(json);
    	return createForMap(map);
    }
    
    public static List<Yx> createForJson(List<String> jsons){
    	List<Yx> yxs = new ArrayList<Yx>();
    	for(String json : jsons){
    		yxs.add(createForJson(json));
    	}
    	return yxs;
    }
    
    /** 级联删除(延迟入库) */
    public boolean deleteAndSon(){
    	return false;
    }
    
    /** 级联删除(及时入库) */
    public boolean deleteAndSonAndFlush(){
    	return false;
    }
    
    /** 延迟插入数据库 */
    public Yx insert(){
    	return YxImp.insert(this);
    }
    /** 延迟更新数据库 */
    public Yx update(){
    	return YxImp.update(this);
    }
    /** 延迟删除数据库 */
    public boolean delete(){
    	return YxImp.delete(this);
    }
    /** 即时插入数据库 */
    public Yx insertAndFlush(){
    	return YxImp.insertAndFlush(this);
    }
    /** 即时更新数据库 */
    public Yx updateAndFlush(){
    	return YxImp.updateAndFlush(this);
    }
    /** 即时删除数据库 */
    public boolean deleteAndFlush(){
    	return YxImp.deleteAndFlush(this);
    }
    
    
    
    //--------------------------------Cache 中的索引 GET & SET
	public String getId_Unique(){
		return id_Unique;
	}
	
	public void setId_Unique(String id_Unique){
		this.id_Unique = id_Unique;
	}
	
	public String getWjid_Index(){
		return wjid_Index;
	}
	
	public void setWjid_Index(String wjid_Index){
		this.wjid_Index = wjid_Index;
	}
	
	public String getZrid_Index(){
		return zrid_Index;
	}
	
	public void setZrid_Index(String zrid_Index){
		this.zrid_Index = zrid_Index;
	}
	
	public String getDj_Index(){
		return dj_Index;
	}
	
	public void setDj_Index(String dj_Index){
		this.dj_Index = dj_Index;
	}
	
	public String getZt_Index(){
		return zt_Index;
	}
	
	public void setZt_Index(String zt_Index){
		this.zt_Index = zt_Index;
	}
	
	
	
	/** 取得改变的索引 */
	public Map<String,String> getUpdateIndexs(){
		Map<String,String> indexNames = new HashMap<String,String>();
		if(!this.getId_Unique().equals(SK_Plus.b(id).e())){
			indexNames.put(Yx.Id_IndexName,SK_Plus.b(id).e());
			indexNames.put("isUpdtaeUnique","true");
		}
			
		if(!this.getWjid_Index().equals(SK_Plus.b(wjid).e()))
			indexNames.put(Yx.Wjid_IndexName,SK_Plus.b(wjid).e());
			
		if(!this.getZrid_Index().equals(SK_Plus.b(zrid).e()))
			indexNames.put(Yx.Zrid_IndexName,SK_Plus.b(zrid).e());
			
		if(!this.getDj_Index().equals(SK_Plus.b(dj).e()))
			indexNames.put(Yx.Dj_IndexName,SK_Plus.b(dj).e());
			
		if(!this.getZt_Index().equals(SK_Plus.b(zt).e()))
			indexNames.put(Yx.Zt_IndexName,SK_Plus.b(zt).e());
			
		return indexNames;
	}
	
	//索引名称
	public static final String  Id_IndexName = "id";
	public static final String  Wjid_IndexName = "wjid";
	public static final String  Zrid_IndexName = "zrid";
	public static final String  Dj_IndexName = "dj";
	public static final String  Zt_IndexName = "zt";
	
	
	//Cache 中的索引
	private String  id_Unique = null;
	private String  wjid_Index = null;
	private String  zrid_Index = null;
	private String  dj_Index = null;
	private String  zt_Index = null;
	public Yx updatePrimaryIndex(){
		return updatePrimaryIndex(this);
	}
	
	public static List<Yx> updatePrimaryIndex(List<Yx> yxs){
		for(Yx yx : yxs){
			updatePrimaryIndex(yx);	
		}
		return yxs;
	}
	
	public static Yx updatePrimaryIndex(Yx yx){
		String field = SK_Plus.b(yx.getId()).e();
		yx.setId_Unique(field);
		
		field = SK_Plus.b(yx.getWjid()).e();
		yx.setWjid_Index(field);
		
		field = SK_Plus.b(yx.getZrid()).e();
		yx.setZrid_Index(field);
		
		field = SK_Plus.b(yx.getDj()).e();
		yx.setDj_Index(field);
		
		field = SK_Plus.b(yx.getZt()).e();
		yx.setZt_Index(field);
		
		return yx;
	}
}